function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

var preview = false,
    previewMenuId = parentMenuId,
    previewResourceId = resourceIds,
    resourceConfigsData = null;
topSerachSize = 7;
var windowObj = window.parent.parentDialogObj ? window.parent.parentDialogObj["resourcePreview"] : null;

if (windowObj) {
  var getTransParams = windowObj.getTransParams().transParams;
  preview = getTransParams.preview;
  previewResourceId = getTransParams.previewResourceId;
  resourceConfigsData = getTransParams.data;
}

var grid;
var resourcesData = {},
    searchSelectMap = {},
    searchDateMap = {},
    searchSelectPeople = {};
var listType = ""; //TODO 影响一些逻辑判断，例如 回退分辦

var openFrom = null; //TODO 影响一些逻辑判断，例如 回退分辦

var matchRequestToken = ""; //影响一些逻辑判断，撤销流程

var hasWorkflowEvent = ""; //影响一些逻辑判断，撤销流程

var _wfctxPath = "/seeyon"; //影响一些逻辑判断，当前待办人

var sendedocRole = sendEdocRoleFromBack || edocQuickSendRoleFrromBack ? 1 : 0;
var edocURL = _ctxPath + "/govdoc/govdoc.do";
var edocListURL = _ctxPath + "/govdoc/list.do";
var toolbar = null;
var deduplicationMark = false; //记录一个标记，记录同一流程只显示一条

var searchobj;
var proxyState = false; //本人事项代理查询状态标记

var page = {};
page.data = {};

page.data.getSelected = function () {
  return grid.grid.getSelectRows();
};
/**
 * 初始化企业风格-公文列表
 * @returns
 */


$(document).ready(function () {
  //企业风格：列表需要去掉页签占用高度
  $(".queryIframe").height(document.body.offsetHeight - 55); //获取传参：父menuId

  resourceVo.menuId = parentMenuId; //根据菜单ID获取资源包信息

  callBackendMethod("govdocResourceEngineManager", "getPageByMenuId", resourceVo.menuId, {
    success: function success(data) {
      if (!data || data.length == 0) {
        $.alert($.i18n("govdoc.resource.rolePreview.noData")); //暂无数据

        return;
      }

      ; //第一个页签

      var firstData = data[0];
      var isFromNiwen = false; //表示具体的某一资源链接

      if (data.length == 1) {
        if (isNewGovResource()) {
          //拟文
          isFromNiwen = true;
          document.title = firstData.name;
        }
      } //初始化导航菜单


      if (!isFromNiwen) {
        _initNavData(data, firstData.resourceId);
      } //定制平台配置


      if (firstData.baseVo) {
        //自定义资源为url
        if (firstData.baseVo.resourceNavurl) {
          $("#queryIframe").show();
          $(".container").hide();
          $("#queryIframe").attr("src", _ctxPath + firstData.baseVo.resourceNavurl); //return;
        } //初始化资源对象 resourceVo


        _initResourceVo(firstData.baseVo, firstData.resourceId);
      } //初始化定制平台列表


      initApplyList();
    },
    error: function error(err) {
      $.error(err.responseText);
    }
  }); //_initEvent();  //初始化事件
});
/**
 * 初始化导航页签
 * @param data
 * @param resourceId
 * @returns
 */

function _initNavData(data, resourceId) {
  var navData = [];
  $(data).each(function (i, index) {
    navData.push({
      id: index.id,
      resourceId: index.resourceId,
      name: index.name,
      baseVo: index.baseVo
    });
  });
  resourcesData.navData = navData;

  _initRenderNav(resourceId); //初始化顶部页签

}
/**
 * 初始化导航页签
 * @param currentId
 * @returns
 */


function _initRenderNav(currentId) {
  var navData = resourcesData.navData;
  if (!navData) return;
  var items = [];
  $(navData).each(function (i, index) {
    //如果资源ID是当前传进来的资源ID及为默认选中
    items.push({
      index: i,
      label: index.name || "页签" + i,
      id: index.id,
      resourceId: index.resourceId,
      clickFun: _resouceNavClickFun,
      current: i == 0 ? true : false
    });
  });
  var testData1 = {
    size: "L",
    styleType: 1,
    items: items
  };

  if (items && items.length > 1) {
    var headerNav = new CtpUiTabs(document.getElementById("headerNavContent"), testData1);
    topSearchSize = 47;
  }
} //初始化小查询模块；


function _loadSearch(data) {
  //加载小查询时清空高级查询的配置
  var searchContainer = $("#searchItemContaier");
  searchContainer.html('');
  var searchColumns = search_str == "" ? [] : eval(search_str);
  var enumsMap = data.enmusMap;
  var conditions = [];

  for (var i = 0; i < searchColumns.length; i++) {
    var temp = searchColumns[i];
    var condition = {};
    condition.id = temp.code;
    var flagNumber = 0;

    if ("zhuanFlowState" == temp.code) {
      if (data.dateSource && data.dateSource.affairState && data.dateSource.affairState.length > 0) {
        if (data.dateSource.affairState.length == 1) {
          //判断是资源里面自由待办的时候过滤
          if (data.dateSource.affairState.length == 1) {
            for (var j = 0; j < data.dateSource.affairState.length; j++) {
              var tempAffairState = data.dateSource.affairState[j];

              if (tempAffairState == '3') {
                window.affairState = tempAffairState;
              }
            }
          }
        } else {
          for (var j = 0; j < data.dateSource.affairState.length; j++) {
            var tempAffairState = data.dateSource.affairState[j];

            if (tempAffairState == '5' || tempAffairState == '6') {
              window.affairState = tempAffairState;
              flagNumber = 1;
              break;
            }
          }
        }
      } else {
        //适配searchbox-debug 方法不知那个会赋值
        window.affairState = '';
      }
    }

    condition.name = temp.code;
    condition.value = temp.code;
    condition.text = temp.itemShowName == null || temp.itemShowName == "null" || temp.itemShowName == "" ? temp.editLabel : temp.itemShowName;
    condition.type = temp.resourceEnumItem == null ? "input" : temp.resourceEnumItem.selectType;
    condition.type = condition.type === "other" ? "input" : condition.type;

    if (condition.type == "datemulti") {
      condition.ifFormat = '%Y-%m-%d';
      condition.dateTime = false;
    } else if (condition.type == "select") {
      if (!enumsMap) {
        condition.items = [{
          "value": "",
          "text": ""
        }];
      } else {
        var itemsArray = enumsMap[temp.code];

        if (itemsArray != null) {
          var resetItems = new Array();
          itemsArray = eval('(' + itemsArray + ')');

          for (var j = 0; j < itemsArray.length; j++) {
            var item = itemsArray[j];

            if (flagNumber == 1) {
              if (item.value == '0' || item.value == '2') {
                var item = itemsArray[j];
                var resetItemMap = {};
                resetItemMap.text = item.name == undefined ? item.text : item.name;
                resetItemMap.value = item.value;
                resetItems.push(resetItemMap);
              }
            } else {
              var resetItemMap = {};
              resetItemMap.text = item.name == undefined ? item.text : item.name;
              resetItemMap.value = item.value;
              resetItems.push(resetItemMap);
            }
          }

          condition.items = resetItems;
        }
      }
    } else if (condition.type == "selectPeople") {
      condition.type = "input";
    }

    conditions.push(condition);
  }

  if (conditions.length > 0) {
    searchobj = $.searchCondition({
      top: topSearchSize,
      right: 30,
      searchHandler: function searchHandler() {
        var params = searchobj.g.getReturnValue();

        if (params.value && params.type == "datemulti") {
          params.value = params.value.join("#");
        } else {
          params.value = $("#" + params.condition).val().trim();
        }

        var condition = {};
        condition[params.condition] = params.value;

        if (params !== null) {
          params[params.condition] = params.value;
          params.page = 1;
          params.resourceId = previewResourceId;
          params.preview = preview ? "true" : "false";
          params.condition = condition;
          $("#tableContent").ajaxgridLoad(params);
        }
      },
      conditions: conditions
    });
  }
} //初始化事件


function _initEvent() {
  //搜索按钮点击事件-切换搜索区域的显示或隐藏
  var searchContent = $(".searchContent");
  $("#searchDiv").on("click", function () {
    if (searchContent.hasClass("display_none")) {
      $(this).text($.i18n("govdoc.resource.manage.putIt")); //收起

      searchContent.removeClass("display_none");
    } else {
      $(this).text($.i18n("govdoc.resource.manage.search")); //搜索

      searchContent.addClass("display_none");
    }

    _reloadTableHeight();
  }); //点击查询按钮，执行搜索操作

  /*$("#searchSubmit").on("click",function(){
      if(preview){
          return;
      };
      _reloadSearch( deduplicationMark,proxyState);
  });*/
  //点击重置按钮，取消搜索

  $("#searchCancel").on("click", function () {
    var searchInput = $(".searchInput");
    searchInput.each(function (i, index) {
      var name = index.getAttribute("name");
      this.value = "";
      var selectDomMap = searchSelectMap[name]; //下拉数据

      var dateDomMap = searchDateMap[name]; //时间

      var peopleDomMap = searchSelectPeople[name]; //选人

      if (selectDomMap) {
        selectDomMap.setValue("");
      } else if (dateDomMap) {
        searchDateMap[name].setDateValues({
          startDate: "",
          endDate: ""
        });
      } else if (peopleDomMap) {
        searchSelectPeople[name] = "";
      } else if (name === "affairNodePolicy") {
        //节点权限重置
        index.setAttribute("value", "");
      }
    });
  });
} //点击顶部页签回调


function _resouceNavClickFun(index) {
  //$(".searchDiv").show();
  $(".container").show();
  $("#toolbar").html('');
  searchobj && searchobj.g.destroySearch && searchobj.g.destroySearch();
  var resourceId = this.resourceId;

  if (index != "" && index.toString().length > 10) {
    resourceId = index;
  }

  $("#queryIframe").attr("src", "");
  $("#queryIframe").hide();
  initResourceList(resourceId);
}

page.eventAction = /*#__PURE__*/function () {
  var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(self, row, elemId) {
    var id, o, _url, _url2, _url3, _url4, _url5, rowDatas, selected, state, i, hasState, j, candeleteList;

    return regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            id = typeof elemId === "undefined" ? this.id : elemId;

            if (!("workflowOnlyOne" == id)) {
              _context.next = 7;
              break;
            }

            o = grid.p.params;
            o.deduplication = "false";

            if ($("#workflowOnlyOne").is(":checked")) {
              o.deduplication = "true";
            }

            $("#tableContent").ajaxgridLoad(o);
            return _context.abrupt("return");

          case 7:
            if (!("stepBack" == id)) {
              _context.next = 11;
              break;
            }

            //撤销回退记录
            _url = _ctxPath + '/supervise/supervise.do?method=listRecord&app=4&record=stepBackRecord&openFrom=menuList&resourceId=' + resourceId + '&subapp=';
            callBackendMethod("govdocResourceApplyManager", "getGovDocTypeByResourceId", resourceId, {
              success: function success(data) {
                _url = _url + data;
                window.location.href = _url;
              },
              error: function error(request, settings, e) {
                $.error(e);
              }
            });
            return _context.abrupt("return");

          case 11:
            if (!("quickSend" == id)) {
              _context.next = 17;
              break;
            }

            //快速发文
            _url2 = edocURL + "?method=newGovdoc&sub_app=1&isQuickSend=true&_resourceCode=F20_fawenNewQuickSend";
            openGovdocDialog(_url2, $.i18n('govdoc.newpage'));
            return _context.abrupt("return", true);

          case 17:
            if (!("fawenniwen" == id)) {
              _context.next = 23;
              break;
            }

            //新建 拟文
            _url3 = edocURL + "?method=newGovdoc&sub_app=1&_resourceCode=F20_newSend";
            openGovdocDialog(_url3, $.i18n('govdoc.newpage'));
            return _context.abrupt("return", true);

          case 23:
            if (!("receiveSign" == id)) {
              _context.next = 29;
              break;
            }

            //收文登记
            _url4 = edocURL + "?method=newGovdoc&sub_app=2&_resourceCode=F20_newDengji";
            openGovdocDialog(_url4, $.i18n('govdoc.newpage'));
            return _context.abrupt("return", true);

          case 29:
            if (!("qianbaoniwen" == id)) {
              _context.next = 33;
              break;
            }

            //签报拟文
            _url5 = edocURL + "?method=newGovdoc&sub_app=3&_resourceCode=F20_newSign&";
            openGovdocDialog(_url5, $.i18n('govdoc.newpage'));
            return _context.abrupt("return", true);

          case 33:
            rowDatas = typeof row === "undefined" ? undefined : [row];
            selected = typeof rowDatas === "undefined" ? page.data.getSelected() : rowDatas;
            state = [];

            if (!(selected.length == 0)) {
              _context.next = 41;
              break;
            }

            //如果是行操作
            $.alert($.i18n('govdoc.pleaseselect') + this.name.trim() + $.i18n('govdoc.operation.document'));
            return _context.abrupt("return", true);

          case 41:
            if (selected.length > 0) {
              state[0] = selected[0].affairState;

              for (i = 1; i < selected.length; i++) {
                hasState = false;

                for (j = 0; j < state.length; j++) {
                  if (state[j] == selected[i].affairState) {
                    hasState = true;
                  }
                }

                if (!hasState) {
                  state[state.length] = selected[i].affairState;
                }
              }
            }

          case 42:
            if (!($.ctx.CurrentUser.id != selected[0].affairMemberId)) {
              _context.next = 45;
              break;
            }

            $.alert($.i18n('govdoc.cannot.manipulated'));
            return _context.abrupt("return", true);

          case 45:
            if (!((state.contains(5) || state.contains(6)) && "delete" != id)) {
              _context.next = 48;
              break;
            }

            //除了删除，针对已办中回退、撤销公文，其他toolbar操作提示“已回退或已撤销公文不支持该操作！”
            $.alert($.i18n('govdoc.cannot.deal.event'));
            return _context.abrupt("return", true);

          case 48:
            if (!("edit" == id)) {
              _context.next = 57;
              break;
            }

            if (!(state.length == 1 && state[0] == 1)) {
              _context.next = 53;
              break;
            }

            doEdit(previewMenuId, row);
            _context.next = 55;
            break;

          case 53:
            $.alert($.i18n('govdoc.cannot.edit'));
            return _context.abrupt("return", true);

          case 55:
            _context.next = 166;
            break;

          case 57:
            if (!("batchEdoc" == id)) {
              _context.next = 66;
              break;
            }

            if (!(state.length == 1 && state[0] == 3)) {
              _context.next = 62;
              break;
            }

            batchEdoc(undefined, row);
            _context.next = 64;
            break;

          case 62:
            $.alert($.i18n('govdoc.cannot.batch'));
            return _context.abrupt("return", true);

          case 64:
            _context.next = 166;
            break;

          case 66:
            if (!("delete" == id)) {
              _context.next = 93;
              break;
            }

            // 待发，已办、已发的删除  //后续合并
            candeleteList = [1, 2, 4, 5, 6];

            if (!(state.length == 1)) {
              _context.next = 79;
              break;
            }

            if (!candeleteList.contains(state[0])) {
              _context.next = 75;
              break;
            }

            if (state == 1) {
              //全部是待发数据
              doDelete('draft', 'tableContent', 'listWaitSend', selected);
            }

            if (state == 2) {
              //全部是已发
              doDelete('sent', 'tableContent', 'listSent', selected);
            }

            if (state == 4 || state[0] == 6 || state[0] == 5) {
              //全部是已办
              doDelete('finish', 'tableContent', 'listDone', selected);
            }

            _context.next = 77;
            break;

          case 75:
            $.alert($.i18n("govdoc.cannot.delete.pending"));
            return _context.abrupt("return", true);

          case 77:
            _context.next = 91;
            break;

          case 79:
            if (!(affairStates.contains("1") && affairStates.contains("3"))) {
              _context.next = 84;
              break;
            }

            $.alert($.i18n('govdoc.cannot.delete.forpending'));
            return _context.abrupt("return", true);

          case 84:
            if (!(affairStates.contains("2") && affairStates.contains("4"))) {
              _context.next = 89;
              break;
            }

            $.alert($.i18n('govdoc.cannot.delete.fordone'));
            return _context.abrupt("return", true);

          case 89:
            $.alert($.i18n('govdoc.cannot.delete'));
            return _context.abrupt("return", true);

          case 91:
            _context.next = 166;
            break;

          case 93:
            if (!("doPigeonhole" == id)) {
              _context.next = 104;
              break;
            }

            if (!(state.length == 1 && (state[0] == 2 || state[0] == 3 || state[0] == 4))) {
              _context.next = 100;
              break;
            }

            if (state == 2) {
              //全部是已发
              doPigeonhole('govdocsent', grid, "tableContent", rowDatas);
            }

            if (state == 3) {
              //全是待发
              doPigeonhole("pending", grid, "tableContent", rowDatas);
            }

            if (state == 4) {
              //全部是已办
              doPigeonhole("govdocdone", grid, "tableContent", rowDatas);
            }

            _context.next = 102;
            break;

          case 100:
            $.alert($.i18n('govdoc.official.document') + row.subject + $.i18n('govdoc.archive.notAllowed'));
            return _context.abrupt("return", true);

          case 102:
            _context.next = 166;
            break;

          case 104:
            if (!("cancel" == id)) {
              _context.next = 113;
              break;
            }

            if (!(state.length == 1 && state[0] == 2)) {
              _context.next = 109;
              break;
            }

            doCancel(undefined, rowDatas);
            _context.next = 111;
            break;

          case 109:
            $.alert($.i18n('govdoc.cannot.revocation'));
            return _context.abrupt("return", true);

          case 111:
            _context.next = 166;
            break;

          case 113:
            if (!("dealTransmitBulletinFunc" == id)) {
              _context.next = 123;
              break;
            }

            if (!(state.length >= 1 && (state[0] == 2 || state[0] == 4))) {
              _context.next = 119;
              break;
            }

            _context.next = 117;
            return dealTransmitBulletinFunc(undefined, rowDatas);

          case 117:
            _context.next = 121;
            break;

          case 119:
            $.alert($.i18n('govdoc.cannot.announcement'));
            return _context.abrupt("return", true);

          case 121:
            _context.next = 166;
            break;

          case 123:
            if (!("doTakeBack" == id)) {
              _context.next = 132;
              break;
            }

            if (!(state.length == 1 && state[0] == 4)) {
              _context.next = 128;
              break;
            }

            doTakeBack(undefined, rowDatas);
            _context.next = 130;
            break;

          case 128:
            $.alert($.i18n('govdoc.cannot.retrieved'));
            return _context.abrupt("return", true);

          case 130:
            _context.next = 166;
            break;

          case 132:
            if (!("turnToRec" == id)) {
              _context.next = 141;
              break;
            }

            if (!(state.length >= 1 && (state[0] == 3 || state[0] == 2 || state[0] == 4))) {
              _context.next = 137;
              break;
            }

            turnToRec(undefined, rowDatas);
            _context.next = 139;
            break;

          case 137:
            $.alert($.i18n('govdoc.cannot.transfer'));
            return _context.abrupt("return", true);

          case 139:
            _context.next = 166;
            break;

          case 141:
            if (!("doForward" == id)) {
              _context.next = 150;
              break;
            }

            if (!(state.length >= 1 && (state[0] == 3 || state[0] == 4))) {
              _context.next = 146;
              break;
            }

            doForward(undefined, rowDatas);
            _context.next = 148;
            break;

          case 146:
            $.alert($.i18n('govdoc.cannot.repost'));
            return _context.abrupt("return", true);

          case 148:
            _context.next = 166;
            break;

          case 150:
            if (!("doForwardCol" == id)) {
              _context.next = 159;
              break;
            }

            if (!(state.length >= 1 && state[0] == 4)) {
              _context.next = 155;
              break;
            }

            doForwardCol(undefined, rowDatas);
            _context.next = 157;
            break;

          case 155:
            $.alert($.i18n('govdoc.cannot.tx'));
            return _context.abrupt("return", true);

          case 157:
            _context.next = 166;
            break;

          case 159:
            if (!("backfenban" == id)) {
              _context.next = 166;
              break;
            }

            if (!(state.length == 1 && state[0] == 1)) {
              _context.next = 164;
              break;
            }

            doTakeDeal();
            _context.next = 166;
            break;

          case 164:
            $.alert($.i18n('govdoc.cannot.branch'));
            return _context.abrupt("return", true);

          case 166:
          case "end":
            return _context.stop();
        }
      }
    }, _callee, this);
  }));

  return function (_x, _x2, _x3) {
    return _ref.apply(this, arguments);
  };
}();
/**
 * 初始化resourceVo对象
 * @param data
 * @param resourceId
 * @returns
 */


function _initResourceVo(data, resourceId) {
  if (!data) return;
  resourceVo.navData = data.navData; //页签

  resourceVo.listStyle = "1"; //企业风格

  resourceVo.toolBars = data.toolBars;
  resourceVo.dataSources = [];
  resourceVo.dataSources[0] = data.dateSource;
  resourceVo.dataSource = data.dateSource;
  resourceVo.showCulomns = data.showFields;
  resourceVo.rowButtons = data.rowButtons;
  resourceVo.showParams = data.searchData;
  resourceVo.searchColumns = search_str == "" ? [] : eval(search_str);
  resourceVo.searchEnums = data.enmusMap;
  deduplication = data.deduplication; //企业风格是导航中默认第一个页签

  initOneResourceVo(data, resourceId);
}

function _initAdvanceConditions() {
  var searchColumns = resourceVo.searchColumns;
  var enumsMap = resourceVo.searchEnums;
  var dateSource = resourceVo.dateSource;
  var conditions = [];

  for (var i = 0; i < searchColumns.length; i++) {
    var temp = searchColumns[i];
    var condition = {};
    condition.id = temp.code;
    var flagNumber = 0;

    if ("zhuanFlowState" == temp.code) {
      if (dateSource && dateSource.affairState && dateSource.affairState.length > 0) {
        if (dateSource.affairState.length == 1) {
          //判断是资源里面自由待办的时候过滤
          if (dateSource.affairState.length == 1) {
            for (var j = 0; j < dateSource.affairState.length; j++) {
              var tempAffairState = dateSource.affairState[j];

              if (tempAffairState == '3') {
                window.affairState = tempAffairState;
              }
            }
          }
        } else {
          for (var j = 0; j < dateSource.affairState.length; j++) {
            var tempAffairState = dateSource.affairState[j];

            if (tempAffairState == '5' || tempAffairState == '6') {
              window.affairState = tempAffairState;
              flagNumber = 1;
              break;
            }
          }
        }
      } else {
        //适配searchbox-debug 方法不知那个会赋值
        window.affairState = '';
      }
    }

    condition.name = temp.code;
    condition.value = temp.code;
    condition.text = temp.itemShowName == null || temp.itemShowName == "null" || temp.itemShowName == "" ? temp.editLabel : temp.itemShowName;
    condition.type = temp.resourceEnumItem == null ? "input" : temp.resourceEnumItem.selectType;
    condition.type = condition.type === "other" ? "input" : condition.type;

    if (condition.type == "datemulti") {
      condition.ifFormat = '%Y-%m-%d';
      condition.dateTime = false;
    } else if (condition.type == "select") {
      if (!enumsMap) {
        condition.items = [{
          "value": "",
          "text": ""
        }];
      } else {
        var itemsArray = enumsMap[temp.code];

        if (itemsArray != null) {
          var resetItems = new Array();
          itemsArray = eval('(' + itemsArray + ')');

          for (var j = 0; j < itemsArray.length; j++) {
            var item = itemsArray[j];

            if (flagNumber == 1) {
              if (item.value == '0' || item.value == '2') {
                var item = itemsArray[j];
                var resetItemMap = {};
                resetItemMap.text = item.name == undefined ? item.text : item.name;
                resetItemMap.value = item.value;
                resetItems.push(resetItemMap);
              }
            } else {
              var resetItemMap = {};
              resetItemMap.text = item.name == undefined ? item.text : item.name;
              resetItemMap.value = item.value;
              resetItems.push(resetItemMap);
            }
          }

          condition.items = resetItems;
        }
      }
    } else if (condition.type == "selectPeople") {
      condition.type = "input";
    }

    conditions.push(condition);
  }

  if (conditions.length > 0) {
    searchobj = $.searchCondition({
      top: topSearchSize,
      right: 30,
      searchHandler: function searchHandler() {
        var params = searchobj.g.getReturnValue();

        if (params.value && params.type == "datemulti") {
          params.value = params.value.join("#");
        } else {
          params.value = $("#" + params.condition).val().trim();
        }

        var condition = {};
        condition[params.condition] = params.value;

        if (params !== null) {
          params[params.condition] = params.value;
          params.page = 1;
          params.resourceId = previewResourceId;
          params.preview = preview ? "true" : "false";
          params.condition = condition;
          $("#tableContent").ajaxgridLoad(params);
        }
      },
      conditions: conditions
    });
  }
}